package com.cn.qtms.entity;

import com.cn.qtms.base.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * <p>
 * 订单详情表
 * </p>
 *
 * @author neil
 * @since 2019-08-08
 */
@Entity
@Table(name = "tm_order_detail")
@org.hibernate.annotations.Table(appliesTo = "tm_order_detail",comment="订单详情表")
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class TmOrderDetail extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @Column(name = "order_id", columnDefinition = "bigint(20) COMMENT '订单号'")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long orderId;


    @JoinColumn(name = "order_id",insertable =false,updatable = false)
    @OneToOne(fetch = FetchType.LAZY)
    private TmOrder tmOrder;

    @Column(name = "goods_id", columnDefinition = "bigint(20) COMMENT '商品编号'")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long goodsId;

    @Column(name = "status", columnDefinition = "char(1) default '0' COMMENT '状态:0 已取消1已下单2已支付3已完成'")
    private String status;


    @Column(name = "remark", columnDefinition = "varchar(255) COMMENT '备注'")
    private String remark;

    @Column(name = "total_points", columnDefinition = "int COMMENT '订单总额'")
    private Integer totalPoints;

    @Column(name = "actual_points", columnDefinition = "int COMMENT '实付金额'")
    private Integer actualPoints;

}
